`timescale 1ns / 1ps

module Harz_E(
    input [4:0] E_A1,
    input [4:0] E_A2,
    input [1:0] E_Tu1,
    input [1:0] E_Tu2,
    input [4:0] M_A3,
    input M_RegWr,
    input [2:0] M_RinSel,
    input [1:0] M_Tn,
    input [4:0] W_A3,
    input W_RegWr,
    input [1:0] W_Tn,
    output reg [2:0] E_FA1,
    output reg [2:0] E_FA2
    );

    always @(*) begin
             if(M_A3 == E_A1 && M_RegWr && !M_Tn && E_A1 && M_RinSel == 3'b011) 
            E_FA1 = 3'b010;
        else if(M_A3 == E_A1 && M_RegWr && !M_Tn && E_A1 && M_RinSel == 3'b010)
            E_FA1 = 3'b100;
        else if(M_A3 == E_A1 && M_RegWr && !M_Tn && E_A1)
            E_FA1 = 3'b001;
        else if(W_A3 == E_A1 && W_RegWr && !W_Tn && E_A1) 
            E_FA1 = 3'b011;
        else E_FA1 = 3'b000;

             if(M_A3 == E_A2 && M_RegWr && !M_Tn && E_A2 && M_RinSel == 3'b011) 
            E_FA2 = 3'b010;
        else if(M_A3 == E_A2 && M_RegWr && !M_Tn && E_A2 && M_RinSel == 3'b010)
            E_FA2 = 3'b100;
        else if(M_A3 == E_A2 && M_RegWr && !M_Tn && E_A2)
            E_FA2 = 3'b001;
        else if(W_A3 == E_A2 && W_RegWr && !W_Tn && E_A2) 
            E_FA2 = 3'b011;
        else E_FA2 = 3'b000;     
    end

endmodule
